﻿@page "/graph"
@page "/graph/index"
@attribute [Authorize(Roles = "User, Administrator")]
@inherits OwningComponentBase<ICovenantService>

@using Microsoft.JSInterop
@using Covenant.Core
@using Covenant.Models.Listeners
@inject IJSRuntime IJSRuntime

<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3">
    <h1 class="h2">Graph</h1>
</div>

<GraphBox Listeners="Listeners" />

@code {
    [Parameter]
    public IEnumerable<Listener> Listeners { get; set; }

    protected override async Task OnInitializedAsync()
    {
        this.Listeners = this.Listeners ?? await Service.GetListeners();
    }
}
